home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / VBSamples / DirectShow / Editing / DexterVB / modDexter.bas < prev    next >
Encoding:
BASIC Source File  |  2001-10-08  |  58.9 KB  |  1,155 lines

  1. Attribute VB_Name = "modDexter"
  2. '*******************************************************************************
  3. '*       This is a part of the Microsoft DXSDK Code Samples.
  4. '*       Copyright (C) 1999-2001 Microsoft Corporation.
  5. '*       All rights reserved.
  6. '*       This source code is only intended as a supplement to
  7. '*       Microsoft Development Tools and/or SDK documentation.
  8. '*       See these sources for detailed information regarding the
  9. '*       Microsoft samples programs.
  10. '*******************************************************************************
  11. Option Explicit
  12. Option Base 0
  13. Option Compare Text
  14.  
  15. 'user for async rendering procedures
  16. Private m_objMediaEvent As IMediaEvent
  17. Private m_objFilterGraph As IGraphBuilder
  18. Private m_objRenderEngine As RenderEngine
  19. Private m_objFilterGraphManager As New FilgraphManager
  20.  
  21.  
  22. ' **************************************************************************************************************************************
  23. ' * GLOBAL INTERFACE- ENUMERATIONS
  24. ' *
  25. ' *
  26.             'supported export formats
  27.             Public Enum DEXExportFormatEnum
  28.             DEXExportXTL = 0
  29.             DEXExportGRF = 1
  30.             End Enum
  31.  
  32.             'supported import formats
  33.             Public Enum DEXImportFormatEnum
  34.             DEXImportXTL = 0
  35.             End Enum
  36.             
  37.             'supported media groups
  38.             Public Enum DEXMediaTypeEnum
  39.             DEXMediaTypeAudio = 1
  40.             DEXMediaTypeVideo = 0
  41.             End Enum
  42.             
  43.             
  44.  
  45. ' **************************************************************************************************************************************
  46. ' * GLOBAL INTERFACE- PROCEDURES
  47. ' *
  48. ' *
  49.             ' ******************************************************************************************************************************
  50.             ' * procedure name: ClearTimeline
  51.             ' * procedure description: purges the given timeline of all groups
  52.             ' *                                      NOTE: YOU MUST CALL THIS ON ANY AMTIMELINES YOU HAVE BEFORE RELEASING
  53.             ' *                                      THEM (e.g. BEFORE YOUR APP SHUTS DOWN) OR SO AS TO FREE MEMORY RESOURCES
  54.             ' ******************************************************************************************************************************
  55.             Public Sub ClearTimeline(objTimeline As AMTimeline)
  56.             On Local Error GoTo ErrLine
  57.              
  58.             If Not objTimeline Is Nothing Then
  59.                Call objTimeline.ClearAllGroups
  60.             End If
  61.             Exit Sub
  62.             
  63. ErrLine:
  64.             Err.Clear
  65.             Exit Sub
  66.             End Sub
  67.             
  68.             
  69.             ' ******************************************************************************************************************************
  70.             ' * procedure name: SaveTimeline
  71.             ' * procedure description:  Persists a timeline to a file given the specified format
  72.             ' *
  73.             ' ******************************************************************************************************************************
  74.             Public Sub SaveTimeline(objTimeline As AMTimeline, bstrFileName As String, Optional Format As DEXExportFormatEnum = DEXExportXTL)
  75.             Dim objXml2Dex As Xml2Dex
  76.             Dim objFilterGraph As IGraphBuilder
  77.             Dim objRenderEngine As RenderEngine
  78.             On Local Error GoTo ErrLine
  79.             
  80.             If Not objTimeline Is Nothing Then
  81.                Select Case LCase(Format)
  82.                     Case DEXExportFormatEnum.DEXExportXTL
  83.                         'Persist the timeline using the dexter XTL File Format
  84.                         Set objXml2Dex = New Xml2Dex
  85.                         objXml2Dex.WriteXMLFile objTimeline, bstrFileName
  86.                         
  87.                     Case DEXExportFormatEnum.DEXExportGRF
  88.                         'Persist the timeline to a DShow Filter Graph Format
  89.                         Set objXml2Dex = New Xml2Dex
  90.                         Set objRenderEngine = New RenderEngine
  91.                         Call objRenderEngine.SetTimelineObject(objTimeline)
  92.                         Call objRenderEngine.ConnectFrontEnd
  93.                         Call objRenderEngine.RenderOutputPins
  94.                         Call objRenderEngine.GetFilterGraph(objFilterGraph)
  95.                         objXml2Dex.WriteGrfFile objFilterGraph, bstrFileName
  96.                End Select
  97.             End If
  98.             
  99.             'clean-up & dereference
  100.             If Not objXml2Dex Is Nothing Then Set objXml2Dex = Nothing
  101.             If Not objFilterGraph Is Nothing Then Set objFilterGraph = Nothing
  102.             If Not objRenderEngine Is Nothing Then Set objRenderEngine = Nothing
  103.             Exit Sub
  104.             
  105. ErrLine:
  106.             Err.Clear
  107.             Exit Sub
  108.             End Sub
  109.  
  110.  
  111.             
  112.             ' ******************************************************************************************************************************
  113.             ' * procedure name: RestoreTimeline
  114.             ' * procedure description:  Restores a timeline from a file given the specified format
  115.             ' *
  116.             ' ******************************************************************************************************************************
  117.             Public Sub RestoreTimeline(objTimeline As AMTimeline, bstrFileName As String, Optional Format As DEXImportFormatEnum = DEXImportXTL)
  118.             Dim objXml2Dex As Xml2Dex
  119.             On Local Error GoTo ErrLine
  120.             
  121.             If Not objTimeline Is Nothing Then
  122.                Select Case LCase(Format)
  123.                     Case DEXImportFormatEnum.DEXImportXTL
  124.                         'restore the timeline from a dexter XTL File Format
  125.                         Set objXml2Dex = New Xml2Dex
  126.                         Call objXml2Dex.ReadXMLFile(objTimeline, bstrFileName)
  127.                End Select
  128.             End If
  129.             
  130.             'clean-up & dereference
  131.             If Not objXml2Dex Is Nothing Then Set objXml2Dex = Nothing
  132.             Exit Sub
  133.             
  134. ErrLine:
  135.             Err.Clear
  136.             Exit Sub
  137.             End Sub
  138.             
  139.             
  140.             
  141.             ' ******************************************************************************************************************************
  142.             ' * procedure name: CreateTimeline
  143.             ' * procedure description:  creates a AMTimeline object
  144.             ' *
  145.             ' ******************************************************************************************************************************
  146.             Public Function CreateTimeline() As AMTimeline
  147.             On Local Error GoTo ErrLine
  148.             'instantiate return value direct
  149.             Set CreateTimeline = New AMTimeline
  150.             Exit Function
  151.             
  152. ErrLine:
  153.             Err.Clear
  154.             Exit Function
  155.             End Function
  156.             
  157.             
  158.             
  159.             ' ******************************************************************************************************************************
  160.             ' * procedure name: CreateGroup
  161.             ' * procedure description:  creates a group object given the passed properties (group name & mediatype)  on the given timeline
  162.             ' *                                       groups can only be inserted into a timeline; so you could use this function with 'InsertGroup' typically
  163.             ' ******************************************************************************************************************************
  164.             Public Function CreateGroup(objTimeline As AMTimeline, bstrGroupName As String, MediaType As DEXMediaTypeEnum, Optional OutputFPS As Double, Optional PreviewMode As Long, Optional OutputBuffer As Long) As AMTimelineGroup
  165.             Dim objGroup As AMTimelineGroup
  166.             Dim objTimelineObject As AMTimelineObj
  167.             On Local Error GoTo ErrLine
  168.             
  169.             'create an empty node on the timeline
  170.             objTimeline.CreateEmptyNode objTimelineObject, TIMELINE_MAJOR_TYPE_GROUP
  171.             'derive the group interface
  172.             Set objGroup = objTimelineObject
  173.             'set the name of the group
  174.             Call objGroup.SetGroupName(bstrGroupName)
  175.             'set the media type for the group
  176.             Call objGroup.SetMediaTypeForVB(MediaType)
  177.             'set the output buffer for the group
  178.             Call objGroup.SetOutputBuffering(OutputBuffer)
  179.             'set the preview mode for the group
  180.             Call objGroup.SetPreviewMode(PreviewMode)
  181.             'set the output fps for the group
  182.             Call objGroup.SetOutputFPS(OutputFPS)
  183.             'return the group to the client
  184.             Set CreateGroup = objGroup
  185.             'clean-up & dereference
  186.             If Not objGroup Is Nothing Then Set objGroup = Nothing
  187.             If Not objTimelineObject Is Nothing Then Set objTimelineObject = Nothing
  188.             Exit Function
  189.             
  190. ErrLine:
  191.             Err.Clear
  192.             Exit Function
  193.             End Function
  194.             
  195.             
  196.             
  197.             ' ******************************************************************************************************************************
  198.             ' * procedure name: CreateComposite
  199.             ' * procedure description: Creates a Composite object on the given timeline
  200.             ' *
  201.             ' ******************************************************************************************************************************
  202.             Public Function CreateComposite(objTimeline As AMTimeline) As AMTimelineComp
  203.             Dim objComp As AMTimelineComp
  204.             Dim objTimelineObject As AMTimelineObj
  205.             On Local Error GoTo ErrLine
  206.             
  207.             'create an empty node on the timeline
  208.             objTimeline.CreateEmptyNode objTimelineObject, TIMELINE_MAJOR_TYPE_COMPOSITE
  209.             'derive the composite interface
  210.             Set objComp = objTimelineObject
  211.             'return the group to the client
  212.             Set CreateComposite = objComp
  213.             'clean-up & dereference
  214.             If Not objComp Is Nothing Then Set objComp = Nothing
  215.             If Not objTimelineObject Is Nothing Then Set objTimelineObject = Nothing
  216.             Exit Function
  217.             
  218. ErrLine:
  219.             Err.Clear
  220.             Exit Function
  221.             End Function
  222.             
  223.             
  224.             
  225.             ' ******************************************************************************************************************************
  226.             ' * procedure name: CreateTrack
  227.             ' * procedure description: Create a track object on the given timeline
  228.             ' *
  229.             ' ******************************************************************************************************************************
  230.             Public Function CreateTrack(objTimeline As AMTimeline) As AMTimelineTrack
  231.             Dim objTrack As AMTimelineTrack
  232.             Dim objTimelineObject As AMTimelineObj
  233.             On Local Error GoTo ErrLine
  234.             
  235.             'create an empty node on the timeline
  236.             objTimeline.CreateEmptyNode objTimelineObject, TIMELINE_MAJOR_TYPE_TRACK
  237.             'derive the track interface
  238.             Set objTrack = objTimelineObject
  239.             'return the track to the client
  240.             Set CreateTrack = objTrack
  241.             'clean-up & dereference
  242.             If Not objTrack Is Nothing Then Set objTrack = Nothing
  243.             If Not objTimelineObject Is Nothing Then Set objTimelineObject = Nothing
  244.             Exit Function
  245.             
  246. ErrLine:
  247.             Err.Clear
  248.             Exit Function
  249.             End Function
  250.             
  251.             
  252.             
  253.             ' ******************************************************************************************************************************
  254.             ' * procedure name: CreateEffect
  255.             ' * procedure description: creates an effect object on the given timeline
  256.             ' *
  257.             ' ******************************************************************************************************************************
  258.             Public Function CreateEffect(objTimeline As AMTimeline) As AMTimelineEffect
  259.             Dim objEffect As AMTimelineEffect
  260.             Dim objTimelineObject As AMTimelineObj
  261.             On Local Error GoTo ErrLine
  262.             
  263.             'create an empty node on the timeline
  264.             objTimeline.CreateEmptyNode objTimelineObject, TIMELINE_MAJOR_TYPE_EFFECT
  265.             'derive the effect interface
  266.             Set objEffect = objTimelineObject
  267.             'return the group to the client
  268.             Set CreateEffect = objEffect
  269.             'clean-up & dereference
  270.             If Not objEffect Is Nothing Then Set objEffect = Nothing
  271.             If Not objTimelineObject Is Nothing Then Set objTimelineObject = Nothing
  272.             Exit Function
  273.             
  274. ErrLine:
  275.             Err.Clear
  276.             Exit Function
  277.             End Function
  278.             
  279.             
  280.             
  281.             ' ******************************************************************************************************************************
  282.             ' * procedure name: CreateTransition
  283.             ' * procedure description: creates a transition object on the given timeline
  284.             ' *
  285.             ' ******************************************************************************************************************************
  286.             Public Function CreateTransition(objTimeline As AMTimeline) As AMTimelineTrans
  287.             Dim objTrans As AMTimelineTrans
  288.             Dim objTimelineObject As AMTimelineObj
  289.             On Local Error GoTo ErrLine
  290.             
  291.             'create an empty node on the timeline
  292.             objTimeline.CreateEmptyNode objTimelineObject, TIMELINE_MAJOR_TYPE_TRANSITION
  293.             'derive the effect interface
  294.             Set objTrans = objTimelineObject
  295.             'return the group to the client
  296.             Set CreateTransition = objTrans
  297.             'clean-up & dereference
  298.             If Not objTrans Is Nothing Then Set objTrans = Nothing
  299.             If Not objTimelineObject Is Nothing Then Set objTimelineObject = Nothing
  300.             Exit Function
  301.             
  302. ErrLine:
  303.             Err.Clear
  304.             Exit Function
  305.             End Function
  306.             
  307.             
  308.             
  309.             ' ******************************************************************************************************************************
  310.             ' * procedure name: CreateSource
  311.             ' * procedure description: creates a clip/source object on the given timeline
  312.             ' *
  313.             ' ******************************************************************************************************************************
  314.             Public Function CreateSource(objTimeline As AMTimeline) As AMTimelineSrc
  315.             Dim objSrc As AMTimelineSrc
  316.             Dim objTimelineObject As AMTimelineObj
  317.             On Local Error GoTo ErrLine
  318.             
  319.             'create an empty node on the timeline
  320.             objTimeline.CreateEmptyNode objTimelineObject, TIMELINE_MAJOR_TYPE_SOURCE
  321.             'derive the source interface
  322.             Set objSrc = objTimelineObject
  323.             'return the source to the client
  324.             Set CreateSource = objSrc
  325.             'clean-up & dereference
  326.             If Not objSrc Is Nothing Then Set objSrc = Nothing
  327.             If Not objTimelineObject Is Nothing Then Set objTimelineObject = Nothing
  328.             Exit Function
  329.             
  330. ErrLine:
  331.             Err.Clear
  332.             Exit Function
  333.             End Function
  334.             
  335.             
  336.             
  337.             ' ******************************************************************************************************************************
  338.             ' * procedure name: GroupFromTimeline
  339.             ' * procedure description:  creates a group object given the passed properties (group name & mediatype)
  340.             ' *                                       groups can only be inserted into a timeline; use this function with 'InsertGroup'
  341.             ' ******************************************************************************************************************************
  342.             Public Function GroupFromTimeline(objTimeline As AMTimeline, Optional Group As Long = 0) As AMTimelineGroup
  343.             Dim objGroup As AMTimelineGroup
  344.             Dim objTimelineObject As AMTimelineObj
  345.             On Local Error GoTo ErrLine
  346.             
  347.             'obtain a Timeline Object from the timeline
  348.             Call objTimeline.GetGroup(objTimelineObject, Group)
  349.             'derive the group interface from the timeline object
  350.             Set objGroup = objTimelineObject
  351.             'returnt the reference to the client
  352.             Set GroupFromTimeline = objGroup
  353.             'clean-up & dereference
  354.             If Not objGroup Is Nothing Then Set objGroup = Nothing
  355.             If Not objTimelineObject Is Nothing Then Set objTimelineObject = Nothing
  356.             Exit Function
  357.             
  358. ErrLine:
  359.             Err.Clear
  360.             Exit Function
  361.             End Function
  362.             
  363.             
  364.             ' ******************************************************************************************************************************
  365.             ' * procedure name: InsertGroup
  366.             ' * procedure description: appends a group to a timeline object; you can only append groups to a timeline
  367.             ' *
  368.             ' ******************************************************************************************************************************
  369.             Public Sub InsertGroup(objDestTimeline As AMTimeline, objSourceGroup As AMTimelineGroup)
  370.             Dim objTimelineObject As AMTimelineObj
  371.             On Local Error GoTo ErrLine
  372.             
  373.             If Not objSourceGroup Is Nothing Then
  374.                If Not objDestTimeline Is Nothing Then
  375.                   'query for the Timelineobj interface
  376.                   Set objTimelineObject = objSourceGroup
  377.                   'append the source group to the destination timeline
  378.                   objDestTimeline.AddGroup objTimelineObject
  379.                   'clean-up & dereference
  380.                   If Not objTimelineObject Is Nothing Then Set objTimelineObject = Nothing
  381.                End If
  382.             End If
  383.             Exit Sub
  384.             
  385. ErrLine:
  386.             Err.Clear
  387.             Exit Sub
  388.             End Sub
  389.             
  390.             
  391.             
  392.             ' ******************************************************************************************************************************
  393.             ' * procedure name: InsertComposite
  394.             ' * procedure description: Inserts Composite into a group or into another composite,
  395.             ' *                                      The second argument, objInsetDestination evaluates to either a group or a composite object
  396.             ' ******************************************************************************************************************************
  397.             Public Sub InsertComposite(objSourceComposite As AMTimelineComp, objInsetDestination As AMTimelineObj, Optional Priority As Long = -1)
  398.             Dim objComp As AMTimelineComp
  399.             Dim objTimelineObject As AMTimelineObj
  400.             On Local Error GoTo ErrLine
  401.             
  402.             If Not objSourceComposite Is Nothing Then
  403.                If Not objInsetDestination Is Nothing Then
  404.                   'query for the composite interface
  405.                   Set objComp = objInsetDestination
  406.                   'query for the timelineobj object
  407.                   Set objTimelineObject = objSourceComposite
  408.                   'insert the comp into the group; or comp & set the priority
  409.                   Call objComp.VTrackInsBefore(objTimelineObject, Priority)
  410.                   'clean-up & dereference
  411.                   If Not objComp Is Nothing Then Set objComp = Nothing
  412.                   If Not objTimelineObject Is Nothing Then Set objTimelineObject = Nothing
  413.                End If
  414.             End If
  415.             Exit Sub
  416.             
  417. ErrLine:
  418.             Err.Clear
  419.             Exit Sub
  420.             End Sub
  421.             
  422.             
  423.             
  424.             ' ******************************************************************************************************************************
  425.             ' * procedure name: InsertTrack
  426.             ' * procedure description: Inserts a track into a group or a composite,
  427.             ' *                                      The second argument, objInsetDestination evaluates to either a group or a composite
  428.             ' ******************************************************************************************************************************
  429.             Public Sub InsertTrack(objTrack As AMTimelineTrack, objInsetDestination As AMTimelineObj, Optional Priority As Long = -1)
  430.             Dim objComp As AMTimelineComp
  431.             Dim objTimelineObject As AMTimelineObj
  432.             On Local Error GoTo ErrLine
  433.             
  434.             If Not objTrack Is Nothing Then
  435.                If Not objInsetDestination Is Nothing Then
  436.                   'query for the composite interface
  437.                   Set objComp = objInsetDestination
  438.                   'query for the timelineobj object
  439.                   Set objTimelineObject = objTrack
  440.                   'insert the comp into the group; or comp & set the priority
  441.                   Call objComp.VTrackInsBefore(objTimelineObject, Priority)
  442.                   'clean-up & dereference
  443.                   If Not objComp Is Nothing Then Set objComp = Nothing
  444.                   If Not objTimelineObject Is Nothing Then Set objTimelineObject = Nothing
  445.                End If
  446.             End If
  447.             Exit Sub
  448.             
  449. ErrLine:
  450.             Err.Clear
  451.             Exit Sub
  452.             End Sub
  453.             
  454.             
  455.             
  456.             ' ******************************************************************************************************************************
  457.             ' * procedure name: InsertEffect
  458.             ' * procedure description: appends an effect to a timeline object
  459.             ' *
  460.             ' ******************************************************************************************************************************
  461.             Public Sub InsertEffect(objSourceEffect As AMTimelineEffect, objInsetDestination As AMTimelineObj, bstrEffectCLSID As String, dblTStart As Double, dblTStop As Double, Optional Priority As Long = -1)
  462.             Dim objTimelineObject As AMTimelineObj
  463.             Dim objTimelineEffectable As IAMTimelineEffectable
  464.             On Local Error GoTo ErrLine
  465.             
  466.             If Not objSourceEffect Is Nothing Then
  467.                If Not objInsetDestination Is Nothing Then
  468.                   'query for the timelineobj object
  469.                   Set objTimelineObject = objSourceEffect
  470.                   Call objTimelineObject.SetSubObjectGUIDB(bstrEffectCLSID)
  471.                   Call objTimelineObject.SetStartStop2(dblTStart, dblTStop)
  472.                   'insert the effect into the destination
  473.                   Set objTimelineEffectable = objInsetDestination
  474.                   Call objTimelineEffectable.EffectInsBefore(objTimelineObject, Priority)
  475.                   'clean-up & dereference
  476.                   If Not objTimelineObject Is Nothing Then Set objTimelineObject = Nothing
  477.                   If Not objTimelineEffectable Is Nothing Then Set objTimelineEffectable = Nothing
  478.                End If
  479.             End If
  480.             Exit Sub
  481.             
  482. ErrLine:
  483.             Err.Clear
  484.             Exit Sub
  485.             End Sub
  486.             
  487.         
  488.             
  489.             ' ******************************************************************************************************************************
  490.             ' * procedure name: InsertSource
  491.             ' * procedure description: inserts a source clip to a timeline object; you can only append source to a track
  492.             ' *
  493.             ' ******************************************************************************************************************************
  494.             Public Sub InsertSource(objDestTrack As AMTimelineTrack, objSourceClip As AMTimelineSrc, bstrMediaName As String, dblTStart As Double, dblTStop As Double, Optional dblMStart As Double, Optional dblMStop As Double)
  495.             Dim objTimelineObject As AMTimelineObj
  496.             On Local Error GoTo ErrLine
  497.             
  498.             If Not objDestTrack Is Nothing Then
  499.                If Not objSourceClip Is Nothing Then
  500.                   'query for the Timelineobj interface
  501.                   Set objTimelineObject = objSourceClip
  502.                   'set start/stop times
  503.                   Call objTimelineObject.SetStartStop2(dblTStart, dblTStop)
  504.                   If dblMStart >= 0 And dblMStop <> 0 Then
  505.                      'set the media times
  506.                      Call objSourceClip.SetMediaTimes2(dblMStart, dblMStop)
  507.                   End If
  508.                   'set the media name
  509.                   Call objSourceClip.SetMediaName(bstrMediaName)
  510.                   'append the source clip to the destination track
  511.                   objDestTrack.SrcAdd objTimelineObject
  512.                   'clean-up & dereference
  513.                   If Not objTimelineObject Is Nothing Then Set objTimelineObject = Nothing
  514.                End If
  515.             End If
  516.             Exit Sub
  517.             
  518. ErrLine:
  519.             Err.Clear
  520.             Exit Sub
  521.             End Sub
  522.             
  523.             
  524.             
  525.             ' ******************************************************************************************************************************
  526.             ' * procedure name: InsertTransition
  527.             ' * procedure description: appends a transition to a timeline object
  528.             ' *
  529.             ' ******************************************************************************************************************************
  530.             Public Sub InsertTransition(objSourceTransition As AMTimelineTrans, objInsetDestination As AMTimelineObj, bstrEffectCLSID As String, dblTStart As Double, dblTStop As Double, Optional Priority As Long = -1)
  531.             Dim objTimelineObject As AMTimelineObj
  532.             Dim objTimelineTransable As IAMTimelineTransable
  533.             On Local Error GoTo ErrLine
  534.             
  535.             If Not objSourceTransition Is Nothing Then
  536.                If Not objInsetDestination Is Nothing Then
  537.                   'query for the timelineobj object
  538.                   Set objTimelineObject = objSourceTransition
  539.                   Call objTimelineObject.SetSubObjectGUIDB(bstrEffectCLSID)
  540.                   Call objTimelineObject.SetStartStop2(dblTStart, dblTStop)
  541.                   'insert the transition into the destination
  542.                   Set objTimelineTransable = objInsetDestination
  543.                   Call objTimelineTransable.TransAdd(objTimelineObject)
  544.                   'clean-up & dereference
  545.                   If Not objTimelineObject Is Nothing Then Set objTimelineObject = Nothing
  546.                   If Not objTimelineTransable Is Nothing Then Set objTimelineTransable = Nothing
  547.                End If
  548.             End If
  549.             Exit Sub
  550.             
  551. ErrLine:
  552.             Err.Clear
  553.             Exit Sub
  554.             End Sub
  555.             
  556.             
  557.             
  558.             ' ******************************************************************************************************************************
  559.             ' * procedure name: EngineFromTimeline
  560.             ' * procedure description: renders the timeline for the client
  561.             ' *
  562.             ' ******************************************************************************************************************************
  563.             Public Function EngineFromTimeline(objTimeline As AMTimeline) As RenderEngine
  564.             Dim objRenderEngine As RenderEngine
  565.             On Local Error GoTo ErrLine
  566.             
  567.             'instantiate new render engine
  568.             Set objRenderEngine = New RenderEngine
  569.             
  570.             'connect everything up..
  571.             Call objRenderEngine.SetTimelineObject(objTimeline)
  572.             objRenderEngine.ConnectFrontEnd
  573.             objRenderEngine.RenderOutputPins
  574.             
  575.             'return the render engine to the client
  576.             Set EngineFromTimeline = objRenderEngine
  577.             
  578.             'dereference & clean-up
  579.             If Not objRenderEngine Is Nothing Then Set objRenderEngine = Nothing
  580.             Exit Function
  581.             
  582. ErrLine:
  583.  
  584.             Err.Clear
  585.             Exit Function
  586.             End Function
  587.             
  588.             
  589.             ' ******************************************************************************************************************************
  590.             ' * procedure name: GraphFromTimeline
  591.             ' * procedure description: returns a graph from the given timeline
  592.             ' *
  593.             ' ******************************************************************************************************************************
  594.             Public Function GraphFromTimeline(objTimeline As AMTimeline) As IGraphBuilder
  595.             Dim objGraphBuilder As IGraphBuilder
  596.             Dim objRenderEngine As RenderEngine
  597.             On Local Error GoTo ErrLine
  598.             
  599.             'instantiate new render engine
  600.             Set objRenderEngine = New RenderEngine
  601.             
  602.             'connect everything up..
  603.             Call objRenderEngine.SetTimelineObject(objTimeline)
  604.             objRenderEngine.ConnectFrontEnd
  605.             objRenderEngine.RenderOutputPins
  606.             
  607.             'return the graph builder to the client
  608.             Call objRenderEngine.GetFilterGraph(objGraphBuilder)
  609.             If Not objGraphBuilder Is Nothing Then Set GraphFromTimeline = objGraphBuilder
  610.             
  611.             'dereference & clean-up
  612.             If Not objGraphBuilder Is Nothing Then Set objGraphBuilder = Nothing
  613.             If Not objRenderEngine Is Nothing Then Set objRenderEngine = Nothing
  614.             Exit Function
  615.             
  616. ErrLine:
  617.             Err.Clear
  618.             Exit Function
  619.             End Function
  620.             
  621.             
  622.             ' ******************************************************************************************************************************
  623.             ' * procedure name: RenderTimelineSync
  624.             ' * procedure description: Renders the timeline for the client, and waits for completion
  625.             ' *                                      until the media completes or until the specified timeout is reached..
  626.             ' *
  627.             ' ******************************************************************************************************************************
  628.             Public Sub RenderTimelineSync(objTimeline As AMTimeline, Optional Timeout As Long = -1)
  629.             Dim nExitCode As Long
  630.             Dim objMediaEvent As IMediaEvent
  631.             Dim objMediaControl As IMediaControl
  632.             Dim objFilterGraph As IGraphBuilder
  633.             Dim objRenderEngine As RenderEngine
  634.             On Local Error GoTo ErrLine
  635.             
  636.             'instantiate new render engine
  637.             Set objRenderEngine = New RenderEngine
  638.             
  639.             'connect everything up..
  640.             Call objRenderEngine.SetTimelineObject(objTimeline)
  641.             objRenderEngine.ConnectFrontEnd
  642.             objRenderEngine.RenderOutputPins
  643.             
  644.             'obtain the filtergraph
  645.             Call objRenderEngine.GetFilterGraph(objFilterGraph)
  646.             Set objMediaEvent = objFilterGraph
  647.             Set objMediaControl = objFilterGraph
  648.             
  649.             'render the graph
  650.             objMediaControl.Run
  651.             'wait for the graph to complete..
  652.             objMediaEvent.WaitForCompletion Timeout, nExitCode
  653.             
  654.             'clean-up & dereference
  655.             If Not objFilterGraph Is Nothing Then Set objFilterGraph = Nothing
  656.             If Not objMediaEvent Is Nothing Then Set objMediaEvent = Nothing
  657.             If Not objMediaControl Is Nothing Then Set objMediaControl = Nothing
  658.             If Not objRenderEngine Is Nothing Then Set objRenderEngine = Nothing
  659.             Exit Sub
  660.             
  661. ErrLine:
  662.             Err.Clear
  663.             Exit Sub
  664.             End Sub
  665.             
  666.             
  667.             ' ******************************************************************************************************************************
  668.             ' * procedure name: RenderTimelineAsync
  669.             ' * procedure description: renders the timeline for the client and returns an instance of the filter graph manager
  670.             ' *                                      NOTE:  THIS PROCEDURE USES MODULE-LEVEL VARIABLES BECAUSE
  671.             ' *                                                   IT WORKS ASYNCRONOUSLY.  IF YOU MOVE THEM OVER LOCALLY
  672.             ' *                                                   YOUR APPLICATION WILL TAKE A READ FAULT BECAUSE QEDIT WILL
  673.             ' *                                                   NOT BE ABLE TO READ YOUR FILTERGRAPH WHEN THE PROCEDURE EXITS.
  674.             ' ******************************************************************************************************************************
  675.             Public Function RenderTimeline(objTimeline As AMTimeline, Optional UseDynamicConnections As Boolean, Optional UseSmartRecompression As Boolean) As FilgraphManager
  676.             On Local Error GoTo ErrLine
  677.             
  678.             'instantiate new render engine
  679.             Set m_objRenderEngine = New RenderEngine
  680.             
  681.             'setup dynamic connections
  682.             If UseDynamicConnections = True Then
  683.                Call m_objRenderEngine.SetDynamicReconnectLevel(1)
  684.             Else: Call m_objRenderEngine.SetDynamicReconnectLevel(0)
  685.             End If
  686.             
  687.             'setup smart recompression
  688.             If UseSmartRecompression = True Then
  689.                'smart recompression is not currently supported in vb
  690.             End If
  691.             
  692.             'connect everything up..
  693.             Call m_objRenderEngine.SetTimelineObject(objTimeline)
  694.             m_objRenderEngine.ConnectFrontEnd
  695.             m_objRenderEngine.RenderOutputPins
  696.             
  697.             'render the audio/video
  698.             Call m_objRenderEngine.GetFilterGraph(m_objFilterGraph)
  699.             Set m_objFilterGraphManager = New FilgraphManager
  700.             Set m_objFilterGraphManager = m_objFilterGraph
  701.             
  702.             'return an instance of the filgraph manager to the client
  703.             Set RenderTimeline = m_objFilterGraphManager
  704.             Exit Function
  705.             
  706. ErrLine:
  707.  
  708.             Err.Clear
  709.             Exit Function
  710.             End Function
  711.             
  712.             
  713.             
  714.             ' ******************************************************************************************************************************
  715.             ' * procedure name: RenderTimelineAsync
  716.             ' * procedure description: renders the timeline for the client in true async fashion
  717.             ' *                                      NOTE:  THIS PROCEDURE USES MODULE-LEVEL VARIABLES BECAUSE
  718.             ' *                                                   IT WORKS ASYNCRONOUSLY.  IF YOU MOVE THEM OVER LOCALLY
  719.             ' *                                                   YOUR APPLICATION WILL TAKE A READ FAULT BECAUSE QEDIT WILL
  720.             ' *                                                   NOT BE ABLE TO READ YOUR FILTERGRAPH WHEN THE PROCEDURE EXITS.
  721.             ' ******************************************************************************************************************************
  722.             Public Sub RenderTimelineAsync(objTimeline As AMTimeline)
  723.             On Local Error GoTo ErrLine
  724.             
  725.             'instantiate new render engine
  726.             Set gbl_objRenderEngine = New RenderEngine
  727.             
  728.             'connect everything up..
  729.             Call gbl_objRenderEngine.SetTimelineObject(objTimeline)
  730.             gbl_objRenderEngine.ConnectFrontEnd
  731.             gbl_objRenderEngine.RenderOutputPins
  732.             
  733.             'render the audio/video
  734.             Call gbl_objRenderEngine.GetFilterGraph(m_objFilterGraph)
  735.             Set m_objFilterGraphManager = New FilgraphManager
  736.             Set m_objFilterGraphManager = m_objFilterGraph
  737.             m_objFilterGraphManager.Run
  738.             Exit Sub
  739.             
  740. ErrLine:
  741.  
  742.             Err.Clear
  743.             Exit Sub
  744.             End Sub
  745.             
  746.             
  747.             
  748.             ' ******************************************************************************************************************************
  749.             ' * procedure name: RenderTimelineQuasiAsync
  750.             ' * procedure description: Renders the timeline for the client, and waits for completion by using
  751.             ' *                                      a structured loop which constantly checks the current position of the media.
  752.             ' *                                      By using the VB 'WithEvents' Keyword normal form events are uninhibited.
  753.             ' *                                      as VB will basically handle the multi-threading for you.
  754.             ' ******************************************************************************************************************************
  755.             Public Sub RenderTimelineQuasiAsync(objTimeline As AMTimeline)
  756.             Dim objPosition As IMediaPosition
  757.             Dim objFilterGraph As IGraphBuilder
  758.             Dim objRenderEngine As RenderEngine
  759.             Dim objFilterGraphManager As New FilgraphManager
  760.             On Local Error GoTo ErrLine
  761.             
  762.             'instantiate new render engine
  763.             Set objRenderEngine = New RenderEngine
  764.             
  765.             'connect everything up..
  766.             Call objRenderEngine.SetTimelineObject(objTimeline)
  767.             objRenderEngine.ConnectFrontEnd
  768.             objRenderEngine.RenderOutputPins
  769.             
  770.             'render the audio/video
  771.             Call objRenderEngine.GetFilterGraph(objFilterGraph)
  772.             Set objFilterGraphManager = New FilgraphManager
  773.             Set objFilterGraphManager = objFilterGraph
  774.             objFilterGraphManager.Run
  775.             'obtain the position of audio/video
  776.             Set objPosition = objFilterGraphManager
  777.             
  778.             'loop with events
  779.             Do: DoEvents
  780.             If objPosition.CurrentPosition = objPosition.StopTime Then
  781.                Call objFilterGraphManager.Stop
  782.                Exit Do
  783.             End If
  784.             Loop
  785.             
  786.             'clean-up & dereference
  787.             If Not objPosition Is Nothing Then Set objPosition = Nothing
  788.             If Not objFilterGraph Is Nothing Then Set objFilterGraph = Nothing
  789.             If Not objRenderEngine Is Nothing Then Set objRenderEngine = Nothing
  790.             If Not objFilterGraphManager Is Nothing Then Set objFilterGraphManager = Nothing
  791.             Exit Sub
  792.             
  793. ErrLine:
  794.             Err.Clear
  795.             Exit Sub
  796.             End Sub
  797.  
  798.  
  799.  
  800.             
  801.             ' ******************************************************************************************************************************
  802.             ' * procedure name: RunFilterGraphSync
  803.             ' * procedure description: playsback the filtergraph for the client synchronously, and returns.
  804.             ' *
  805.             ' ******************************************************************************************************************************
  806.             Public Sub RunFilterGraphSync(objGraph As IFilterGraph)
  807.             Dim nExitCode As Long
  808.             Dim objMediaEvent As IMediaEvent
  809.             Dim objMediaControl As IMediaControl
  810.             On Local Error GoTo ErrLine
  811.             
  812.             'obtain the media control, event
  813.             Set objMediaEvent = objGraph
  814.             Set objMediaControl = objGraph
  815.             
  816.             'render the graph
  817.             objMediaControl.Run
  818.             'wait for play to complete..
  819.             objMediaEvent.WaitForCompletion -1, nExitCode
  820.             
  821.             'clean-up & dereference
  822.             If Not objMediaEvent Is Nothing Then Set objMediaEvent = Nothing
  823.             If Not objMediaControl Is Nothing Then Set objMediaControl = Nothing
  824.             Exit Sub
  825.             
  826. ErrLine:
  827.             Err.Clear
  828.             Exit Sub
  829.             End Sub
  830.             
  831.             
  832.            
  833.             
  834.             ' ******************************************************************************************************************************
  835.             ' * procedure name: TransitionCLSIDToFriendlyName
  836.             ' * procedure description: returns the localized friendly name of a transition given it's CLSID
  837.             ' *
  838.             ' ******************************************************************************************************************************
  839.              Public Function TransitionCLSIDToFriendlyName(bstrTransitionCLSID As String, Optional bstrLanguage As String = "EN-US") As String
  840.              Dim bstrReturn As String
  841.              On Local Error GoTo ErrLine
  842.              
  843.              If UCase(bstrLanguage) = "EN-US" Then
  844.                          Select Case bstrTransitionCLSID
  845.                             Case "{C3BDF740-0B58-11d2-A484-00C04F8EFB69}"
  846.                                 bstrReturn = "Barn"
  847.                             Case "{00C429C0-0BA9-11d2-A484-00C04F8EFB69}"
  848.                                 bstrReturn = "Blinds"
  849.                             Case "{107045D1-06E0-11D2-8D6D-00C04F8EF8E0}"
  850.                                 bstrReturn = "BurnFilm"
  851.                             Case "{AA0D4D0C-06A3-11D2-8F98-00C04FB92EB7}"
  852.                                 bstrReturn = "CenterCurls"
  853.                             Case "{2A54C908-07AA-11D2-8D6D-00C04F8EF8E0}"
  854.                                 bstrReturn = "ColorFade"
  855.                             Case "{9A43A844-0831-11D1-817F-0000F87557DB}"
  856.                                 bstrReturn = "Compositor"
  857.                             Case "{AA0D4D0E-06A3-11D2-8F98-00C04FB92EB7}"
  858.                                 bstrReturn = "Curls"
  859.                             Case "{AA0D4D12-06A3-11D2-8F98-00C04FB92EB7}"
  860.                                 bstrReturn = "Curtains"
  861.                             Case "{16B280C5-EE70-11D1-9066-00C04FD9189D}"
  862.                                 bstrReturn = "Fade"
  863.                             Case "{107045CC-06E0-11D2-8D6D-00C04F8EF8E0}"
  864.                                 bstrReturn = "FadeWhite"
  865.                             Case "{2A54C90B-07AA-11D2-8D6D-00C04F8EF8E0}"
  866.                                 bstrReturn = "FlowMotion"
  867.                             Case "{2A54C913-07AA-11D2-8D6D-00C04F8EF8E0}"
  868.                                 bstrReturn = "GlassBlock"
  869.                             Case "{2A54C911-07AA-11D2-8D6D-00C04F8EF8E0}"
  870.                                 bstrReturn = "Grid"
  871.                             Case "{93073C40-0BA5-11d2-A484-00C04F8EFB69}"
  872.                                 bstrReturn = "Inset"
  873.                             Case "{3F69F351-0379-11D2-A484-00C04F8EFB69}"
  874.                                 bstrReturn = "Iris"
  875.                             Case "{2A54C904-07AA-11D2-8D6D-00C04F8EF8E0}"
  876.                                 bstrReturn = "Jaws"
  877.                             Case "{107045CA-06E0-11D2-8D6D-00C04F8EF8E0}"
  878.                                 bstrReturn = "Lens"
  879.                             Case "{107045C8-06E0-11D2-8D6D-00C04F8EF8E0}"
  880.                                 bstrReturn = "LightWipe"
  881.                             Case "{AA0D4D0A-06A3-11D2-8F98-00C04FB92EB7}"
  882.                                 bstrReturn = "Liquid"
  883.                             Case "{AA0D4D08-06A3-11D2-8F98-00C04FB92EB7}"
  884.                                 bstrReturn = "PageCurl"
  885.                             Case "{AA0D4D10-06A3-11D2-8F98-00C04FB92EB7}"
  886.                                 bstrReturn = "PeelABCD"
  887.                             Case "{4CCEA634-FBE0-11d1-906A-00C04FD9189D}"
  888.                                 bstrReturn = "Pixelate"
  889.                             Case "{424B71AF-0695-11D2-A484-00C04F8EFB69}"
  890.                                 bstrReturn = "RadialWipe"
  891.                             Case "{AA0D4D03-06A3-11D2-8F98-00C04FB92EB7}"
  892.                                 bstrReturn = "Ripple"
  893.                             Case "{9C61F46E-0530-11D2-8F98-00C04FB92EB7}"
  894.                                 bstrReturn = "RollDown"
  895.                             Case "{810E402F-056B-11D2-A484-00C04F8EFB69}"
  896.                                 bstrReturn = "Slide"
  897.                             Case "{dE75D012-7A65-11D2-8CEA-00A0C9441E20}"
  898.                                 bstrReturn = "SMPTE Wipe"
  899.                             Case "{ACA97E00-0C7D-11d2-A484-00C04F8EFB69}"
  900.                                 bstrReturn = "Spiral"
  901.                             Case "{7658F2A2-0A83-11d2-A484-00C04F8EFB69}"
  902.                                 bstrReturn = "Stretch"
  903.                             Case "{2A54C915-07AA-11D2-8D6D-00C04F8EF8E0}"
  904.                                 bstrReturn = "Threshold"
  905.                             Case "{107045CF-06E0-11D2-8D6D-00C04F8EF8E0}"
  906.                                 bstrReturn = "Twister"
  907.                             Case "{2A54C90D-07AA-11D2-8D6D-00C04F8EF8E0}"
  908.                                 bstrReturn = "Vacuum"
  909.                             Case "{107045C5-06E0-11D2-8D6D-00C04F8EF8E0}"
  910.                                 bstrReturn = "Water"
  911.                             Case "{5AE1DAE0-1461-11d2-A484-00C04F8EFB69}"
  912.                                 bstrReturn = "Wheel"
  913.                             Case "{AF279B30-86EB-11D1-81BF-0000F87557DB}"
  914.                                 bstrReturn = "Wipe"
  915.                             Case "{0E6AE022-0C83-11D2-8CD4-00104BC75D9A}"
  916.                                 bstrReturn = "WormHole"
  917.                             Case "{E6E73D20-0C8A-11d2-A484-00C04F8EFB69}"
  918.                                 bstrReturn = "Zigzag"
  919.                             Case Else: bstrReturn = vbNullString
  920.                         End Select
  921.             End If
  922.             'return friendly name to the client
  923.             TransitionCLSIDToFriendlyName = bstrReturn
  924.             Exit Function
  925.             
  926. ErrLine:
  927.             Err.Clear
  928.             Exit Function
  929.             End Function
  930.              
  931.              
  932.              
  933.             ' ******************************************************************************************************************************
  934.             ' * procedure name: TransitionFriendlyNameToCLSID
  935.             ' * procedure description: returns the CLSID of a transition given it's localized friendly name
  936.             ' *
  937.             ' ******************************************************************************************************************************
  938.              Public Function TransitionFriendlyNameToCLSID(bstrFriendlyName As String, Optional bstrLanguage As String = "EN-US") As String
  939.              Dim bstrReturn As String
  940.              On Local Error GoTo ErrLine
  941.              
  942.              If UCase(bstrLanguage) = "EN-US" Then
  943.                         Select Case bstrFriendlyName
  944.                             Case "Barn"
  945.                                       bstrReturn = "{C3BDF740-0B58-11d2-A484-00C04F8EFB69}"
  946.                             Case "Blinds"
  947.                                       bstrReturn = "{00C429C0-0BA9-11d2-A484-00C04F8EFB69}"
  948.                             Case "BurnFilm"
  949.                                       bstrReturn = "{107045D1-06E0-11D2-8D6D-00C04F8EF8E0}"
  950.                             Case "CenterCurls"
  951.                                       bstrReturn = "{AA0D4D0C-06A3-11D2-8F98-00C04FB92EB7}"
  952.                             Case "ColorFade"
  953.                                       bstrReturn = "{2A54C908-07AA-11D2-8D6D-00C04F8EF8E0}"
  954.                             Case "Compositor"
  955.                                       bstrReturn = "{9A43A844-0831-11D1-817F-0000F87557DB}"
  956.                             Case "Curls"
  957.                                       bstrReturn = "{AA0D4D0E-06A3-11D2-8F98-00C04FB92EB7}"
  958.                             Case "Curtains"
  959.                                       bstrReturn = "{AA0D4D12-06A3-11D2-8F98-00C04FB92EB7}"
  960.                             Case "Fade"
  961.                                       bstrReturn = "{16B280C5-EE70-11D1-9066-00C04FD9189D}"
  962.                             Case "FadeWhite"
  963.                                       bstrReturn = "{107045CC-06E0-11D2-8D6D-00C04F8EF8E0}"
  964.                             Case "FlowMotion"
  965.                                       bstrReturn = "{2A54C90B-07AA-11D2-8D6D-00C04F8EF8E0}"
  966.                             Case "GlassBlock"
  967.                                       bstrReturn = "{2A54C913-07AA-11D2-8D6D-00C04F8EF8E0}"
  968.                             Case "Grid"
  969.                                       bstrReturn = "{2A54C911-07AA-11D2-8D6D-00C04F8EF8E0}"
  970.                             Case "Inset"
  971.                                       bstrReturn = "{93073C40-0BA5-11d2-A484-00C04F8EFB69}"
  972.                             Case "Iris"
  973.                                       bstrReturn = "{3F69F351-0379-11D2-A484-00C04F8EFB69}"
  974.                             Case "Jaws"
  975.                                       bstrReturn = "{2A54C904-07AA-11D2-8D6D-00C04F8EF8E0}"
  976.                             Case "Lens"
  977.                                       bstrReturn = "{107045CA-06E0-11D2-8D6D-00C04F8EF8E0}"
  978.                             Case "LightWipe"
  979.                                       bstrReturn = "{107045C8-06E0-11D2-8D6D-00C04F8EF8E0}"
  980.                             Case "Liquid"
  981.                                       bstrReturn = "{AA0D4D0A-06A3-11D2-8F98-00C04FB92EB7}"
  982.                             Case "PageCurl"
  983.                                       bstrReturn = "{AA0D4D08-06A3-11D2-8F98-00C04FB92EB7}"
  984.                             Case "PeelABCD"
  985.                                       bstrReturn = "{AA0D4D10-06A3-11D2-8F98-00C04FB92EB7}"
  986.                             Case "Pixelate"
  987.                                       bstrReturn = "{4CCEA634-FBE0-11d1-906A-00C04FD9189D}"
  988.                             Case "RadialWipe"
  989.                                       bstrReturn = "{424B71AF-0695-11D2-A484-00C04F8EFB69}"
  990.                             Case "Ripple"
  991.                                       bstrReturn = "{AA0D4D03-06A3-11D2-8F98-00C04FB92EB7}"
  992.                             Case "RollDown"
  993.                                       bstrReturn = "{9C61F46E-0530-11D2-8F98-00C04FB92EB7}"
  994.                             Case "Slide"
  995.                                       bstrReturn = "{810E402F-056B-11D2-A484-00C04F8EFB69}"
  996.                             Case "SMPTE Wipe"
  997.                                       bstrReturn = "{dE75D012-7A65-11D2-8CEA-00A0C9441E20}"
  998.                             Case "Spiral"
  999.                                       bstrReturn = "{ACA97E00-0C7D-11d2-A484-00C04F8EFB69}"
  1000.                             Case "Stretch"
  1001.                                       bstrReturn = "{7658F2A2-0A83-11d2-A484-00C04F8EFB69}"
  1002.                             Case "Threshold"
  1003.                                       bstrReturn = "{2A54C915-07AA-11D2-8D6D-00C04F8EF8E0}"
  1004.                             Case "Twister"
  1005.                                       bstrReturn = "{107045CF-06E0-11D2-8D6D-00C04F8EF8E0}"
  1006.                             Case "Vacuum"
  1007.                                       bstrReturn = "{2A54C90D-07AA-11D2-8D6D-00C04F8EF8E0}"
  1008.                             Case "Water"
  1009.                                       bstrReturn = "{107045C5-06E0-11D2-8D6D-00C04F8EF8E0}"
  1010.                             Case "Wheel"
  1011.                                       bstrReturn = "{5AE1DAE0-1461-11d2-A484-00C04F8EFB69}"
  1012.                             Case "Wipe"
  1013.                                       bstrReturn = "{AF279B30-86EB-11D1-81BF-0000F87557DB}"
  1014.                             Case "WormHole"
  1015.                                       bstrReturn = "{0E6AE022-0C83-11D2-8CD4-00104BC75D9A}"
  1016.                             Case "Zigzag"
  1017.                                       bstrReturn = "{E6E73D20-0C8A-11d2-A484-00C04F8EFB69}"
  1018.                             Case Else: bstrReturn = vbNullString
  1019.                         End Select
  1020.             End If
  1021.             'return friendly name to the client
  1022.             TransitionFriendlyNameToCLSID = bstrReturn
  1023.             Exit Function
  1024.             
  1025. ErrLine:
  1026.             Err.Clear
  1027.             Exit Function
  1028.             End Function
  1029.             
  1030.             
  1031.             
  1032.             ' ******************************************************************************************************************************
  1033.             ' * procedure name: EffectCLSIDToFriendlyName
  1034.             ' * procedure description: returns the localized friendly name of an effect given it's CLSID
  1035.             ' *
  1036.             ' ******************************************************************************************************************************
  1037.              Public Function EffectCLSIDToFriendlyName(bstrTransitionCLSID As String, Optional bstrLanguage As String = "EN-US") As String
  1038.              Dim bstrReturn As String
  1039.              On Local Error GoTo ErrLine
  1040.              
  1041.              If UCase(bstrLanguage) = "EN-US" Then
  1042.                          Select Case bstrTransitionCLSID
  1043.                             Case "{16B280C8-EE70-11D1-9066-00C04FD9189D}"
  1044.                                      bstrReturn = "BasicImage"
  1045.                             Case "{7312498D-E87A-11d1-81E0-0000F87557DB}"
  1046.                                      bstrReturn = "Blur"
  1047.                             Case "{421516C1-3CF8-11D2-952A-00C04FA34F05}"
  1048.                                      bstrReturn = "Chroma"
  1049.                             Case "{ADC6CB86-424C-11D2-952A-00C04FA34F05}"
  1050.                                      bstrReturn = "DropShadow"
  1051.                             Case "{F515306D-0156-11d2-81EA-0000F87557DB}"
  1052.                                      bstrReturn = "Emboss"
  1053.                             Case "{F515306E-0156-11d2-81EA-0000F87557DB}"
  1054.                                      bstrReturn = "Engrave"
  1055.                             Case "{16B280C5-EE70-11D1-9066-00C04FD9189D}"
  1056.                                      bstrReturn = "Fade"
  1057.                             Case "{4CCEA634-FBE0-11d1-906A-00C04FD9189D}"
  1058.                                      bstrReturn = "Pixelate"
  1059.                             Case Else: bstrReturn = vbNullString
  1060.                         End Select
  1061.             End If
  1062.             'return friendly name to the client
  1063.             EffectCLSIDToFriendlyName = bstrReturn
  1064.             Exit Function
  1065.             
  1066. ErrLine:
  1067.             Err.Clear
  1068.             Exit Function
  1069.             End Function
  1070.              
  1071.               
  1072.               
  1073.             ' ******************************************************************************************************************************
  1074.             ' * procedure name: EffectFriendlyNameToCLSID
  1075.             ' * procedure description: returns the CLSID of an effect given it's localized friendly name
  1076.             ' *
  1077.             ' ******************************************************************************************************************************
  1078.              Public Function EffectFriendlyNameToCLSID(bstrFriendlyName As String, Optional bstrLanguage As String = "EN-US") As String
  1079.              Dim bstrReturn As String
  1080.              On Local Error GoTo ErrLine
  1081.              
  1082.              If UCase(bstrLanguage) = "EN-US" Then
  1083.                         Select Case bstrFriendlyName
  1084.                             Case "BasicImage"
  1085.                                      bstrReturn = "{16B280C8-EE70-11D1-9066-00C04FD9189D}"
  1086.                             Case "Blur"
  1087.                                      bstrReturn = "{7312498D-E87A-11d1-81E0-0000F87557DB}"
  1088.                             Case "Chroma"
  1089.                                      bstrReturn = "{421516C1-3CF8-11D2-952A-00C04FA34F05}"
  1090.                             Case "DropShadow"
  1091.                                      bstrReturn = "{ADC6CB86-424C-11D2-952A-00C04FA34F05}"
  1092.                             Case "Emboss"
  1093.                                      bstrReturn = "{F515306D-0156-11d2-81EA-0000F87557DB}"
  1094.                             Case "Engrave"
  1095.                                      bstrReturn = "{F515306E-0156-11d2-81EA-0000F87557DB}"
  1096.                             Case "Fade"
  1097.                                      bstrReturn = "{16B280C5-EE70-11D1-9066-00C04FD9189D}"
  1098.                             Case "Pixelate"
  1099.                                      bstrReturn = "{4CCEA634-FBE0-11d1-906A-00C04FD9189D}"
  1100.                             Case Else: bstrReturn = vbNullString
  1101.                         End Select
  1102.             End If
  1103.             'return friendly name to the client
  1104.             EffectFriendlyNameToCLSID = bstrReturn
  1105.             Exit Function
  1106.             
  1107. ErrLine:
  1108.             Err.Clear
  1109.             Exit Function
  1110.             End Function
  1111.             
  1112.             
  1113.             
  1114.             ' ******************************************************************************************************************************
  1115.             ' * procedure name: GetGroupCount
  1116.             ' * procedure description: returns the number of groups encapsulated within the given timeline
  1117.             ' *
  1118.             ' ******************************************************************************************************************************
  1119.             Public Function GetGroupCount(objTimeline As AMTimeline) As Long
  1120.             Dim nCount As Long
  1121.             On Local Error GoTo ErrLine
  1122.              
  1123.             'obtain the number of groups
  1124.             Call objTimeline.GetGroupCount(nCount)
  1125.             'return the group count
  1126.             GetGroupCount = nCount
  1127.             Exit Function
  1128.             
  1129. ErrLine:
  1130.             Err.Clear
  1131.             Exit Function
  1132.             End Function
  1133.             
  1134.             
  1135.             
  1136.             ' ******************************************************************************************************************************
  1137.             ' * procedure name: HasGroups
  1138.             ' * procedure description: returns a boolean indicating wether or not the specified timeline has any any groups inserted
  1139.             ' *
  1140.             ' ******************************************************************************************************************************
  1141.             Public Function HasGroups(objTimeline As AMTimeline) As Boolean
  1142.             Dim nCount As Long
  1143.             On Local Error GoTo ErrLine
  1144.              
  1145.             'obtain the number of groups
  1146.             Call objTimeline.GetGroupCount(nCount)
  1147.             'return the group count
  1148.             If nCount > 0 Then HasGroups = True
  1149.             Exit Function
  1150.             
  1151. ErrLine:
  1152.             Err.Clear
  1153.             Exit Function
  1154.             End Function
  1155.